#include "global.h"
#include "cvt.h"
int main()
{
	int numbound;
	Polygon bound;
	std::vector<Point> v_p;
	std::cin>>numbound;
	for (int i = 0; i < numbound; ++i)
	{
		Point p;
		std::cin>>p;
		bound.push_back(p);
	}
	
	int numseeds;
	std::cin>>numseeds;
	for (int i = 0; i < numseeds; ++i)
	{
		Point p;
		std::cin>>p;
		v_p.push_back(p);
	}
        

	CVT obj(bound,v_p);
	std::cout<<obj.size()<<std::endl;
	for (unsigned i = 0; i < obj.size(); ++i)
	{
		Polygon p;
		obj.convert_face_region(i, p);
		std::cout<<p<<std::endl;
	}
	//std::vector<Point>  result;
	//std::vector<Polygon>  faces;
    	//lloyd(v_p,  bound, result,  faces, 1e-8);
	//simple_increment (v_p, bound, result, faces, 1e-7);
    	

	return 0;
}
